<script type="text/javascript">
    function TyxxcjManagerCtrl($rootScope, $scope, $http, modalService, CtrlUtil, $element, UploadService) {
        var ctrl = this;
        ctrl.type = $rootScope.$user.type;
        CtrlUtil.build(ctrl, ':root/tyxxAudit/list')
        this.query = function () {
            ctrl.entities && (ctrl.entities.content = {});
            var p = CtrlUtil.getQueryParams(ctrl)
            $http.post(':root/tyxxAudit/list', p).success(function (r) {
                angular.forEach(r.content, function (v, k) {
                    v.$disableCheck = !((v.shzt.dm == 20 && ctrl.type == 1) || (v.shzt.dm == 30 && ctrl.type == 2));
                });
                ctrl.entities = r;
            })
        }
        this.del = function (item) {
            modalService.confirm({
                content: '删除会删除团员信息采集且无法恢复，确定要删除申报记录吗?',
                result: item
            }).then(function (r) {
                $http.post(':root/tyxxcj/delTyxxcjzb', r).success(function (R) {
                    modalService.succ('删除成功', 1500)
                    ctrl.query();
                })
            })

        }
        CtrlUtil.loadDepartment(ctrl);
    }

</script>
<div ng-controller="TyxxcjManagerCtrl as ctrl" ng-init="ctrl.query()">

    <!-- Search area -->
    <div class="panel panel-cys">
        <div class="panel-heading">
            <h3 class="panel-title">
                <span class="glyphicon glyphicon-search"></span> 信息查询
            </h3>
        </div>
        <div class="panel-body">
            <div class="container-fluid">
                <form class="form-horizontal">
                    <div ng-if="ctrl.type > 1" class="form-group col-md-4 remove-margin-horizontal">
                        <div class="col-md-10 col-md-offset-1">
                            <select class="form-control" chosen ng-options="m.id as m.name for m in ctrl.departments" ng-model="ctrl.departmentQueryParam">
                                <option value="">院系</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group col-md-4 remove-margin-horizontal">
                        <div class="col-md-10 col-md-offset-1">
                            <select chosen ng-model="ctrl.shztQueryParam" class="form-control">
                                <option value="">审核状态</option>
                                <option value="20">院系审核</option>
                                <option value="30">学校审核</option>
                                <option value="99">审核通过</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group col-md-4 remove-margin-horizontal">
                        <div class="col-md-10 col-md-offset-1">
                            <div class="form-control-static">&nbsp;</div>
                        </div>
                    </div>
                </form>
                <div class="row pull-right">
                    <div class="col-md-12">
                        <button ng-click="ctrl.query()" type="submit" class="btn btn-cys btn-sm">
                            <span class="glyphicon glyphicon-search"></span>
                            查询
                        </button>
                        <button ng-click="ctrl.reset()" type="reset" class="btn btn-default btn-sm">
                            <span class="glyphicon glyphicon-repeat"></span>
                            重置
                        </button>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- Search area END -->

    <!-- operation area -->
    <a type="button" class="btn btn-cys btn-sm" ng-click="mainCtrl.toApply()">
        <span class="glyphicon glyphicon-plus"></span>
        批量审核
    </a>
    <div class="pull-right" ng-include="':root/components/page.html'"></div>
    <!-- operation area END -->
    <!-- data grid area -->
    <div style="padding-top: 10px;">
        <table class="table table-bordered table-hover table-striped">
            <tr>
                <th>
                    <input ng-change="ctrl.checkAll(ctrl.$checkAll)" ng-model="ctrl.$checkAll" type="checkbox"/>
                </th>
                <th>院系</th>
                <th>支部</th>
                <th>填报人</th>
                <th>填报日期</th>
                <th>审核状态</th>
                <th>操作</th>
            </tr>
            <tr ng-repeat="item in ctrl.entities.content">
                <td><input ng-model="item.$checked" type="checkbox" ng-disabled="!((item.shzt.dm == 20 && ctrl.type == 1) || (item.shzt.dm == 30 && ctrl.type == 2))"/></td>
                <td>{{item.yx.name}}</td>
                <td>{{item.zbmc.mc}}</td>
                <td>{{item.sbr}}</td>
                <td>{{item.sbrq}}</td>
                <td>{{item.shzt.mc}}</td>
                <td>
                    <a ng-if="(item.shzt.dm == 20 && ctrl.type == 1) || (item.shzt.dm == 30 && ctrl.type == 2)" href="javascript:;" ng-click="mainCtrl.toAuditView(item,false)">审核</a>
                    <a ng-if="!((item.shzt.dm == 20 && ctrl.type == 1) || (item.shzt.dm == 30 && ctrl.type == 2))" href="javascript:;" ng-click="mainCtrl.toAuditView(item,true)">查看</a>
                </td>
            </tr>
        </table>
        <p>
            共有记录：
            <span>{{ctrl.entities.totalElements}}</span> 条
        </p>
    </div>
</div>